<%--
    Циркулярная рассылка.
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" %>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Goodwill - Циркулярная рассылка</title>
    <link rel="stylesheet" href="resources/css/main.css"/>
    <link rel="stylesheet" href="resources/css/stylesheet.css"/>
    <link rel="stylesheet" href="resources/css/clients.css"/>
</head>
<body>
<f:view>
    <jsp:include page="menu.jsp"/>
    <jsp:include page="status.jsp"/>
    <jsp:include page="messages.jsp"/>
    <h:form>
        <h:panelGrid columns="2" cellspacing="0" cellpadding="0" columnClasses="top,top,top" id="CircularGrid">
            <h:panelGroup layout="block" styleClass="" style="padding:10px">
                <h:outputText value="Наименование компании: " styleClass="b"/>
                <h:inputText value="#{CircularDispatchBean.clientName}">
                    <a4j:support event="onkeyup" eventsQueue="#{CircularDispatchBean.clientName}" reRender="list"/>
                </h:inputText>
            </h:panelGroup>
            <rich:spacer/>
            <h:panelGroup layout="block" styleClass="" style="padding:10px">
                <rich:scrollableDataTable frozenColCount="1" height="400" width="300" id="list"
                                          value="#{CircularDispatchBean.listUsers}" var="pick"
                                          selection="#{CircularDispatchBean.listUsersSelected}">
                    <rich:column id="name">
                        <h:outputText value="#{pick.label}" style="width:300px"/>
                    </rich:column>
                </rich:scrollableDataTable>
                <a4j:commandLink action="#{CircularDispatchBean.addUser}" reRender="list, selectedList">
                    <h:graphicImage value="/resources/img/docopen_16.gif"/>
                    <h:outputText value="Копировать"/>
                </a4j:commandLink>
                <a4j:commandLink action="#{CircularDispatchBean.addAllUsers}" reRender="list, selectedList">
                    <h:graphicImage value="/resources/img/docrefresh_16.gif"/>
                    <h:outputText value="Копировать все"/>
                </a4j:commandLink>
            </h:panelGroup>


            <h:panelGroup layout="block" styleClass="" style="padding:10px">
                <rich:scrollableDataTable frozenColCount="1" height="400" width="300" id="selectedList"
                                          value="#{CircularDispatchBean.listUsersAdded}" var="selectedPick"
                                          selection="#{CircularDispatchBean.listUsersAddedSelected}">
                    <rich:column id="name">
                        <h:outputText value="#{selectedPick.label}" style="width:300px"/>
                    </rich:column>
                </rich:scrollableDataTable>
                <a4j:commandLink action="#{CircularDispatchBean.removeUser}" reRender="list, selectedList">
                    <h:graphicImage value="/resources/img/delete.gif"/>
                    <h:outputText value="Удалить"/>
                </a4j:commandLink>
                <a4j:commandLink action="#{CircularDispatchBean.removeAllUsers}" reRender="list, selectedList">
                    <h:graphicImage value="/resources/img/ajax_error.gif"/>
                    <h:outputText value="Удалить все"/>
                </a4j:commandLink>
            </h:panelGroup>

            <h:panelGroup layout="block" styleClass="" style="padding:10px">
                <h:panelGrid columns="2" cellpadding="0" cellspacing="0" columnClasses="dleft,dright">
                    <h:outputText value="Тема сообщения" styleClass="b"/>
                    <h:inputText value="#{CircularDispatchBean.themeMessage}" style="width:400px"/>
                    <h:outputText value="Текст сообщения" styleClass="b"/>
                    <rich:editor value="#{CircularDispatchBean.textMessage}" height="40" style="width:400px" viewMode="source"/>
                    <a4j:commandLink action="#{CircularDispatchBean.sendMessage}" reRender="CircularGrid">
                        <h:graphicImage value="/resources/img/arrow_right_blue_16.png"/>
                        <h:outputText value="Отправить"/>
                    </a4j:commandLink>
                </h:panelGrid>
            </h:panelGroup>
        </h:panelGrid>
    </h:form>
</f:view>
</body>
</html>